package com.hck.types.common;

/**
 * 缓存常量类
 * 定义各种缓存key的前缀和过期时间
 */
public class CacheConstants {
    
    // 用户相关缓存
    public static final String USER_INFO_PREFIX = "user:info:";
    public static final String USER_TOKEN_PREFIX = "user:token:";
    public static final String USER_LOGIN_PREFIX = "user:login:";
    public static final String USER_LIST_PREFIX = "user:list:";
    
    // 医生相关缓存
    public static final String DOCTOR_INFO_PREFIX = "doctor:info:";
    public static final String DOCTOR_TOKEN_PREFIX = "doctor:token:";
    public static final String DOCTOR_LOGIN_PREFIX = "doctor:login:";
    public static final String DOCTOR_LIST_PREFIX = "doctor:list:";
    
    // 咨询相关缓存
    public static final String CONSULTATION_INFO_PREFIX = "consultation:info:";
    public static final String CONSULTATION_USER_PREFIX = "consultation:user:";
    public static final String CONSULTATION_DOCTOR_PREFIX = "consultation:doctor:";
    public static final String CONSULTATION_REPLY_PREFIX = "consultation:reply:";
    
    // 缓存过期时间（秒）
    public static final long USER_INFO_EXPIRE = 1800; // 30分钟
    public static final long USER_TOKEN_EXPIRE = 7200; // 2小时
    public static final long USER_LOGIN_EXPIRE = 1800; // 30分钟
    public static final long USER_LIST_EXPIRE = 900; // 15分钟
    
    public static final long DOCTOR_INFO_EXPIRE = 1800; // 30分钟
    public static final long DOCTOR_TOKEN_EXPIRE = 7200; // 2小时
    public static final long DOCTOR_LOGIN_EXPIRE = 1800; // 30分钟
    public static final long DOCTOR_LIST_EXPIRE = 900; // 15分钟
    
    public static final long CONSULTATION_INFO_EXPIRE = 1800; // 30分钟
    public static final long CONSULTATION_USER_EXPIRE = 900; // 15分钟
    public static final long CONSULTATION_DOCTOR_EXPIRE = 900; // 15分钟
    public static final long CONSULTATION_REPLY_EXPIRE = 1800; // 30分钟
    
    // 通用缓存过期时间
    public static final long DEFAULT_EXPIRE = 1800; // 30分钟
    public static final long LIST_EXPIRE = 900; // 15分钟
    
    /**
     * 获取用户信息缓存key
     */
    public static String getUserInfoKey(Long userId) {
        return USER_INFO_PREFIX + userId;
    }
    
    /**
     * 获取用户Token缓存key
     */
    public static String getUserTokenKey(String token) {
        return USER_TOKEN_PREFIX + token;
    }
    
    /**
     * 获取用户登录缓存key
     */
    public static String getUserLoginKey(Long userId) {
        return USER_LOGIN_PREFIX + userId;
    }
    
    /**
     * 获取用户列表缓存key
     */
    public static String getUserListKey(String listKey) {
        return USER_LIST_PREFIX + listKey;
    }
    
    /**
     * 获取医生信息缓存key
     */
    public static String getDoctorInfoKey(Long doctorId) {
        return DOCTOR_INFO_PREFIX + doctorId;
    }
    
    /**
     * 获取医生Token缓存key
     */
    public static String getDoctorTokenKey(String token) {
        return DOCTOR_TOKEN_PREFIX + token;
    }
    
    /**
     * 获取医生登录缓存key
     */
    public static String getDoctorLoginKey(Long doctorId) {
        return DOCTOR_LOGIN_PREFIX + doctorId;
    }
    
    /**
     * 获取医生列表缓存key
     */
    public static String getDoctorListKey(String listKey) {
        return DOCTOR_LIST_PREFIX + listKey;
    }
    
    /**
     * 获取咨询信息缓存key
     */
    public static String getConsultationInfoKey(Long consultationId) {
        return CONSULTATION_INFO_PREFIX + consultationId;
    }
    
    /**
     * 获取用户咨询列表缓存key
     */
    public static String getUserConsultationsKey(Long userId) {
        return CONSULTATION_USER_PREFIX + userId;
    }
    
    /**
     * 获取医生咨询列表缓存key
     */
    public static String getDoctorConsultationsKey(Long doctorId) {
        return CONSULTATION_DOCTOR_PREFIX + doctorId;
    }
    
    /**
     * 获取咨询回复列表缓存key
     */
    public static String getConsultationRepliesKey(Long consultationId) {
        return CONSULTATION_REPLY_PREFIX + consultationId;
    }
} 